<script type="text/javascript">
$(function(){
	var pg = App.soagov.comIndex.ui,
		gd = pg.find('.grid');

	gd.mac('grid', {
		cols : [{
			field: 'type', title : '类型', width: 80
		},{
			field: 'code', title : '编号', width: 160
		},{
			field: 'name', title : '名称', width: 200
		},{
			field: 'memo', title : '备注', width: 300
		},{
			field: 'opt', title : '操作', width: 40,
			render: function(r) {
				return $('<span class="a"></span>').click(function(){
					mac.confirm('确定要 删除 ' + r.code + ' 组件吗？', function(){
						$.post(App.ctx + '/com/delete.do', {
							id: r.id,
						}, function(rs){
							var ro = mac.eval(rs);
							if (ro.success) {
								gd.load();
							} else {
								mac.alert(ro.data, ro.params);
							}
						});
					});
				}).append('删除');
			}
		}],
		loader: {
			url: App.ctx + '/com/list.do' ,
			params: { pageNo: 1, pageSize: 20 },
			autoLoad: true
		},
		pagerLength: 20
	});
	
	pg.seek('key').keydown(function(e){
		if (e.keyCode == 13) {
			gd.load({ key: $(this).val() });
		}
	});
	pg.seek('back').click(function(){
		App.show({
			ctx : 'soagov',
			action : 'home'
		}, $.noop, $('#body'));
	});

	function adjust(){
		var h = pg.parent().height();
		pg.height(h - 30);
		gd.parent().height(h - 44);
		gd.adjust();
	}
	$(window).resize(adjust);
	adjust(); 
});
</script>
<div class="navi">
	<span class="a" name="back">流程设计</span>&gt;&gt;
	<span name="title">组件管理</span>
</div>
<div class="head">
	关键字查找：<input type="text" name="key" />
</div>
<div class="body">
	<div class="grid" name="grid"></div>
</div>